/*
    $Header: /Windows/Shell/ShellExt.root/ShellExt/src/CPropSht.h 2     08-07-24 0:20 Ken $
    $Log: /Windows/Shell/ShellExt.root/ShellExt/src/CPropSht.h $
 * 
 * 2     08-07-24 0:20 Ken
 * add hook key (inject.dll setwindowshookex)
 *
 * 1     08-01-05 0:08 Ken
*/

// ..\Src\CPropSht.h : Declaration of the CPropSht

#pragma once
#include "resource.h"       // main symbols

#include "ShellExt.h"
#include "CIShellExtImp.h"
#include "CJunction.h"
#include "CStream.h"

// CPropSht

class ATL_NO_VTABLE CPropSht :
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CPropSht, &CLSID_PropSht>,
    public IDispatchImpl<IPropSht, &IID_IPropSht, &LIBID_ShellExtLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
    ,public CIShellExtInitImp
    ,public IShellPropSheetExt
{
public:
    CPropSht()
    {
    }

DECLARE_REGISTRY_RESOURCEID(IDR_PROPSHT)


BEGIN_COM_MAP(CPropSht)
    COM_INTERFACE_ENTRY(IPropSht)
    COM_INTERFACE_ENTRY(IDispatch)
    COM_INTERFACE_ENTRY(IShellExtInit)
    COM_INTERFACE_ENTRY(IShellPropSheetExt)
END_COM_MAP()


    DECLARE_PROTECT_FINAL_CONSTRUCT()

    HRESULT FinalConstruct()
    {
    return S_OK;
    }

    void FinalRelease()
    {
    }

// the init implement
private:
    BOOL VTgtInit(TCHAR* pszFl){return TRUE;};
    BOOL VPreSrcInit(UINT uSrcNumb ){return (1==uSrcNumb)?TRUE:FALSE;};
    BOOL VSrcInit(UINT uSrcId, TCHAR* pszFl, BOOL fLoad=FALSE/*called by Load*/ );


// IShellPropSheetExt
public:
    STDMETHOD(AddPages)(LPFNADDPROPSHEETPAGE, LPARAM);
    STDMETHOD(ReplacePage)(UINT, LPFNADDPROPSHEETPAGE, LPARAM) { return E_NOTIMPL; }

// dialog implement
private:
    static BOOL CALLBACK PropPageDlgProc ( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
    static UINT CALLBACK PropPageCallbackProc ( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp );    // used for release
    BOOL OnInitDialog ( HWND hwnd, LPARAM lParam );
//    BOOL OnInitFlDialog ( HWND hwnd, LPARAM lParam );
//    BOOL OnInitJunctDialog ( HWND hwnd, LPARAM lParam );
    BOOL OnJunctApply ( HWND hwnd, PSHNOTIFY* phdr);

    VOID FillStrmBox(HWND hwnd);
    BOOL OnNewStrm(HWND hwnd);
    BOOL OnDelStrm(HWND hwnd);
    BOOL OnWrt2Fl(HWND hwnd);
    BOOL OnWrt2Strm(HWND hwnd);
    BOOL OnStrmSelChg(HWND hwnd);

private:
//    enum PRPT_TYPE{PRPT_NULL,  PRPT_JUNCT, PRPT_STRM};
//    PRPT_TYPE    m_tp;
    CString    m_cstrSrc;
    CJunction    m_junct;
    CStream    m_strm;
    BY_HANDLE_FILE_INFORMATION m_flinfo;
};

OBJECT_ENTRY_AUTO(__uuidof(PropSht), CPropSht)
